<!--
 * @Author: yan_hai_dong 891236760@qq.com
 * @Date: 2022-08-25 10:36:03
 * @LastEditors: yan_hai_dong 891236760@qq.com
 * @LastEditTime: 2022-08-25 10:50:26
 * @FilePath: \app\src\views\el\upFile\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div>
    <button @click="selectFile">+选择文件</button>
    <input type="file" name="file" id="file" onchange="fileChange" />
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    selectFile() {
      var x = document.createElement("input");
      x.setAttribute("type", "file");
      //   x.setAttribute("accept", "video/*");
      x.click();
      x.onchange = function (e) {
        console.log(e.path.map(({ files }) => files));
      };
    },
    fileChange(a) {
      console.log(a);
    },
  },
};
</script>

<style lang="less" scoped>
</style>